#include <cstdio>
#include <vector>
#include <climits>
#include <algorithm>

struct teacher{
    int key_id;
    int start_time;
    int during_time;
}teacher_data[1001];

using namespace std;

int main(int argc, char const *argv[]) {
    int N, K;
    scanf("%d %d", &N, &K);

    for (int i = 1; i <= K; i++)
        scanf("%d %d %d", &teacher_data[i].key_id, &teacher_data[i].start_time, &teacher_data[i].during_time);

    int key_position[1001];
    for (int i = 1; i <= N; i++)
        key_position[i] = i;

    int initial_time = INT_MAX, end_time = 0;
    for (int i = 1; i <= K; i++){
        if(teacher_data[i].start_time + teacher_data[i].during_time > end_time)
            end_time = teacher_data[i].start_time + teacher_data[i].during_time;
        if(teacher_data[i].start_time < initial_time)
            initial_time = teacher_data[i].start_time;
    }
    int time_count = initial_time;
    while(time_count <= end_time){
        vector<int> put_back;

        for (int i = 1; i <= K; i++){
            if(teacher_data[i].start_time + teacher_data[i].during_time == time_count){
                put_back.push_back(teacher_data[i].key_id);
            }
        }
        if(!put_back.empty()){
            sort(put_back.begin(), put_back.end());
            for (int j = 0; j < put_back.size(); j++) {
                for (int k = 1; k <= N; k++) {
                    if(key_position[k] == -1){
                        key_position[k] = put_back[j];
                        break;
                    }
                }
            }
        }
        for (int i = 1; i <= K; i++){
            if(teacher_data[i].start_time == time_count){
                for (int k = 1; k <= N; k++) {
                    if(key_position[k] == teacher_data[i].key_id){
                        key_position[k] = -1;
                        break;
                    }
                }
            }
        }
        time_count++;
    }

    for (int i = 1; i <= N; i++)
        printf("%d ", key_position[i]);

    return 0;
}